/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current.Structures.Enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Fork
 */
public enum DefenseFortificationEnum {

    MANOR(0, 1000, 0, 0),
    VILLAGE(5, 2000, 5, 100000),
    TOWN(10, 3000, 10, 250000),
    OUTPOST(15, 4000, 15, 500000),
    OUTPOST2(20, 5000, 20, 1000000),
    OUTPOST3(25, 6000, 25, 2000000),
    STRONGHOLD(30, 7000, 30, 3000000),
    STRONGHOLD2(35, 8000, 35, 4000000),
    STRONGHOLD3(40, 9000, 40, 5000000),
    FORTRESS(45, 10000, 45, 7500000),
    FORTRESS2(50, 11000, 50, 10000000),
    FORTRESS3(55, 12000, 55, 15000000),
    CITADEL(60, 13000, 60, 20000000),
    CITADEL2(65, 14000, 65, 30000000),
    CITADEL3(70, 15000, 70, 40000000),
    CASTLE(75, 16000, 75, 50000000),
    CASTLE2(80, 17000, 80, 75000000),
    CASTLE3(85, 18000, 85, 100000000),
    KINGDOM(90, 19000, 90, 150000000),
    KINGDOM2(95, 20000, 95, 200000000),
    KINGDOM3(100, 21000, 100, 250000000),
    EMPIRE(105, 22000, 105, 300000000),
    EMPIRE2(110, 23000, 110, 350000000),
    EMPIRE3(115, 24000, 115, 400000000);

    private final int minLevel;
    private final int fortGold;
    private final int defenseBonus;
    private final int cost;

    private DefenseFortificationEnum(int minLevel, int fortGold, int defenseBonus, int cost) {
        this.minLevel = minLevel;
        this.fortGold = fortGold;
        this.defenseBonus = defenseBonus;
        this.cost = cost;
    }

    public int getCost() {
        return cost;
    }

    public int getDefenseBonus() {
        return defenseBonus;
    }

    public int getFortGold() {
        return fortGold;
    }

    int getMinLevel() {
        return minLevel;
    }

    @Override
    public String toString() {
        switch (this) {
            case MANOR:
                return "Manor";
            case VILLAGE:
                return "Village";
            case TOWN:
                return "Towen";
            case OUTPOST:
                return "Outpost";
            case OUTPOST2:
                return "Outpost Level 2";
            case OUTPOST3:
                return "Outpost Level 3";
            case STRONGHOLD:
                return "Stronghold";
            case STRONGHOLD2:
                return "Stronghold Level 2";
            case STRONGHOLD3:
                return "Stronghold Level 3";
            case FORTRESS:
                return "Fortress";
            case FORTRESS2:
                return "Fortress Level 2";
            case FORTRESS3:
                return "Fortress Level 3";
            case CITADEL:
                return "Citadel";
            case CITADEL2:
                return "Citadel Level 2";
            case CITADEL3:
                return "Citadel Level 3";
            case CASTLE:
                return "Castle";
            case CASTLE2:
                return "Castle Level 2";
            case CASTLE3:
                return "Castle Level 3";
            case KINGDOM:
                return "Kingdom";
            case KINGDOM2:
                return "Kingdom Level 2";
            case KINGDOM3:
                return "Kingdom Level 3";
            case EMPIRE:
                return "Empire";
            case EMPIRE2:
                return "Empire Level 2";
            case EMPIRE3:
                return "Empire Level 3";
            default:
                return "Error: Non existing Fort";
        }
    }

    public List<DefenseFortificationEnum> getCorrectDefFort() {
        ArrayList<DefenseFortificationEnum> aux = new ArrayList<DefenseFortificationEnum>();
        DefenseFortificationEnum[] values = this.values();
        int accountLevel = Preferences.AccountInUse.getAccountInUse().getLevel();
        for (int i = 0; i < accountLevel; i += 5) { // While 'i' is lower than account level look for structures who are available.
            if (values[i].getMinLevel() <= accountLevel) {
                aux.add(values[i]);
            }
        }
        return aux;
    }

    public static DefenseFortificationEnum getCASTLE() {
        return CASTLE;
    }

    public static DefenseFortificationEnum getCASTLE2() {
        return CASTLE2;
    }

    public static DefenseFortificationEnum getCASTLE3() {
        return CASTLE3;
    }

    public static DefenseFortificationEnum getCITADEL() {
        return CITADEL;
    }

    public static DefenseFortificationEnum getCITADEL2() {
        return CITADEL2;
    }

    public static DefenseFortificationEnum getCITADEL3() {
        return CITADEL3;
    }

    public static DefenseFortificationEnum getEMPIRE() {
        return EMPIRE;
    }

    public static DefenseFortificationEnum getEMPIRE2() {
        return EMPIRE2;
    }

    public static DefenseFortificationEnum getEMPIRE3() {
        return EMPIRE3;
    }

    public static DefenseFortificationEnum getFORTRESS() {
        return FORTRESS;
    }

    public static DefenseFortificationEnum getFORTRESS2() {
        return FORTRESS2;
    }

    public static DefenseFortificationEnum getFORTRESS3() {
        return FORTRESS3;
    }

    public static DefenseFortificationEnum getKINGDOM() {
        return KINGDOM;
    }

    public static DefenseFortificationEnum getKINGDOM2() {
        return KINGDOM2;
    }

    public static DefenseFortificationEnum getKINGDOM3() {
        return KINGDOM3;
    }

    public static DefenseFortificationEnum getMANOR() {
        return MANOR;
    }

    public static DefenseFortificationEnum getOUTPOST() {
        return OUTPOST;
    }

    public static DefenseFortificationEnum getOUTPOST2() {
        return OUTPOST2;
    }

    public static DefenseFortificationEnum getOUTPOST3() {
        return OUTPOST3;
    }

    public static DefenseFortificationEnum getSTRONGHOLD() {
        return STRONGHOLD;
    }

    public static DefenseFortificationEnum getSTRONGHOLD2() {
        return STRONGHOLD2;
    }

    public static DefenseFortificationEnum getSTRONGHOLD3() {
        return STRONGHOLD3;
    }

    public static DefenseFortificationEnum getTOWN() {
        return TOWN;
    }

    public static DefenseFortificationEnum getVILLAGE() {
        return VILLAGE;
    }
}
